-
Notifications
You must be signed in to change notification settings - Fork 202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix MaterialX compilation on M1 Macs #2579
Fix MaterialX compilation on M1 Macs #2579
Conversation
Fixes #2267 ? Removes a global struct that was used to pass vertex data around. This is an educated guess based on the GLSL compilation error message I received: ``` ERROR: 0:338: Missing initializer for const variable ‘g_mxVertexData’ ERROR: 0:1557: Use of undeclared identifier ‘g_mxVertexData’ ERROR: 0:1558: Use of undeclared identifier ‘g_mxVertexData’ ERROR: 0:1559: Use of undeclared identifier ‘g_mxVertexData’ ```
Confirmed to work by @hodoulp on his M1 machine. Ready for review. |
// | ||
// And replace with: | ||
// | ||
// HW::T_POSITION_WORLD(PIX_IN.HW::T_POSITION_WORLD) $normalWorld( PIX_IN.$normalWorld ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be further replaced later so we get the familiar Nw( PIX_IN.Nw )
that can be observed in the shader main function if looking with APITrace.
// | ||
// And replace with: | ||
// | ||
// (nothing) $inGeomprop_st |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are captured in the shader main and passed as parameters, so they do not require the PIX_IN
treatment.
Here is the final change in shader code so we see the result in a less abstract form: --- /d/fragment1.glsl 2022-09-06 14:03:14.386810800 -0400
+++ /d/fragment2.glsl 2022-09-06 14:06:13.377655600 -0400
@@ -1,9 +1,3 @@
-struct
-{
- vec3 Nw;
- vec3 Pw;
-} g_mxVertexData;
-
#define MAX_LIGHT_SOURCES 1
struct BSDF { vec3 response; vec3 throughput; float thickness; float ior; };
@@ -1329,9 +1323,9 @@
vec3 coat_affected_diffuse_color_out = pow(base_color, vec3(coat_gamma_out));
surfaceshader shader_constructor_out = surfaceshader(vec3(0.0),vec3(0.0));
{
- vec3 N = normalize(g_mxVertexData.Nw);
- vec3 V = normalize(u_viewPosition - g_mxVertexData.Pw);
- vec3 P = g_mxVertexData.Pw;
+ vec3 N = normalize(Nw( PIX_IN.Nw ));
+ vec3 V = normalize(u_viewPosition - Pw( PIX_IN.Pw ));
+ vec3 P = Pw( PIX_IN.Pw );
float surfaceOpacity = opacity_luminance_out.x;
@@ -1550,13 +1544,11 @@
vec3 emission_color,
vec3 opacity,
bool thin_walled,
- vec3 Nw,
- vec3 Pw)
+ vec3 unused_normalWorld,
+ vec3 unused_positionWorld)
{
- g_mxVertexData.Nw = Nw;
- g_mxVertexData.Pw = Pw;
- vec3 geomprop_Nworld_out = normalize(g_mxVertexData.Nw);
- vec3 geomprop_Pworld_out = g_mxVertexData.Pw;
+ vec3 geomprop_Nworld_out = normalize(Nw( PIX_IN.Nw ));
+ vec3 geomprop_Pworld_out = Pw( PIX_IN.Pw );
vec3 Tw_reader_out = vec3(0.0);
mx_arbitrarytangents_vector3(geomprop_Pworld_out, geomprop_Nworld_out, Tw_reader_out);
surfaceshader SR_USD_Mtlx_VP2_Material_out = surfaceshader(vec3(0.0),vec3(0.0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Timeout glitch on preflight. Ready for merge. |
Fixes #2267 ?
Removes a global struct that was used to pass vertex data around.
This is an educated guess based on the GLSL compilation error message I received: